<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <h1>劳资是页面</h1>
        <button id="btn">获取数据</button>
        <p id="pret"></p>

        <script src="./ajax.js"></script>
        <script>
            btn.onclick = function (e) {
                ajax({
                    url: "/juhe",
                    method: "get",
                    data: {
                        type: "top",
                        // size: "20",
                        key: "b8acdefa84ac17560cb78385d47febee",                       
                    },
                    success(res) {
                        pret.innerText = res
                    },
                    fail(err) {
                        pret.innerText = err.toString()
                    },
                });
            };
        </script>
    </body>
</html>
